package com.youlu.campus.base.base;

import org.springframework.util.StringUtils;

/**
 * @author zgz
 * @date 2020/2/7 15:42
 * 公共枚举类
 */
public class ConstantsEnum {

    public static enum Status {

        ENABLED("enabled", "开启"),
        DISABLED("disabled", "关闭");

        String code;
        String desc;

        Status(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    public static enum Platform {

        QQ("QQ", "QQ小程序"),
        GZ("HT", "后台系统");

        String code;
        String desc;

        Platform(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public static boolean checkPlatform(String platform) {
             if (StringUtils.isEmpty(platform)) {
                 return false;
             }
             for (Platform plat : Platform.values()) {
                 if (plat.getCode().equals(platform)) {
                     return true;
                 }
             }
             return false;
        }
    }

    public static enum ResultStatus {

        SUCCESS("SUCCESS", "成功"),
        FAILED("FAILED", "失败");

        String code;

        String desc;

        ResultStatus(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
}
